package extreme.fizzbuzz.first;

import extreme.fizzbuzz.common.Constants;

/**
 * ClassName: FizzBuzzWhizz
 * Description:
 * Date: 2022/2/10 9:21
 *
 * @author YangXin
 */
public class FizzBuzzWhizz {

    public static void main(String[] args) {
        int studentsCount = (int) (Math.random() * 100 + 100);
        for (int i = 1; i <= studentsCount; i++) {
            System.out.println(i + " say " + getSerialNum(i));
        }
    }

    public static String getSerialNum(int student) {
        if (String.valueOf(student).contains("3")) {
            return Constants.FIZZ;
        }
        StringBuilder serialNum = new StringBuilder();
        if (student % 3 == 0) {
            serialNum.append(Constants.FIZZ);
        }
        if (student % 5 == 0) {
            serialNum.append(Constants.BUZZ);
        }
        if (student % 7 == 0) {
            serialNum.append(Constants.WHIZZ);
        }
        return "".equals(serialNum.toString()) ? String.valueOf(student) : serialNum.toString();
    }
}
